package com.huike.clues.service.impl;


import com.huike.clues.domain.vo.ClueTrackRecordVo;
import com.huike.clues.mapper.TbClueTrackRecordMapper;
import com.huike.clues.service.ITbClueTrackRecordService;
import com.huike.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 线索跟进记录Service业务层处理
 * @date 2022-04-22
 */
@Service
public class TbClueTrackRecordServiceImpl implements ITbClueTrackRecordService {

    @Autowired
    private TbClueTrackRecordMapper trackRecordMapper;

    /**
     * 添加线索跟进记录
     *  添加
     *  可能需要修改用户的基本信息
     *     修改
     * @param tbClueTrackRecord
     */
    @Override
    public void saveClueTrackRecordVo(ClueTrackRecordVo tbClueTrackRecord) {

        //由于传递过来的数据中不存在跟进人
        //获取当前用户 给 tbClueTrackRecord 设置进去
        tbClueTrackRecord.setCreateBy(SecurityUtils.getUsername());

        //添加
        trackRecordMapper.add(tbClueTrackRecord);

        //修改
        trackRecordMapper.updateClueTrackRecordVo(tbClueTrackRecord);
}

    @Override
    public List<ClueTrackRecordVo> selectAll(Long clueId) {
        List<ClueTrackRecordVo> clueTrackRecord = trackRecordMapper.selectAll(clueId);
         return clueTrackRecord;
    }
}
